import request from '@/utils/request'

export const loginByUsername = (username, password, code, randomStr) => {
  let grant_type = 'password'
  let dataObj = qs.stringify({'username': username, 'password': password})

  return request({
    url: '/auth/oauth/token',
    headers: {
      isToken: false,
      'TENANT-ID': '1',
      'Authorization': 'Basic cGlnOnBpZw=='
    },
    method: 'post',
    params: {randomStr, code, grant_type},
    data: dataObj
  })
}

const refreshToken = '/auth/oauth/token';
const loginByMobile = '/auth/mobile/token/sms';
const loginBySocial = '/auth/mobile/token/social';
const getUserInfo = '/admin/user/info';
const logout = '/auth/token/logout';

export {
	refreshToken, loginByMobile, loginBySocial, getUserInfo, logout
};
